<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8"/>
        <title>使用径向渐变</title>
        <meta name="auther" content="wangjiale"/>
        <style>
            canvas{border:medium solid black; margin:4px;}
        </style>
    </head>
    <body>
        <canvas id="canvas" width="500" height="140">
            Your browser doesn't support the <code>canvas</code> element.
        </canvas>
        <script>
            var ctx=document.getElementById("canvas").getContext("2d");
            var grad=ctx.createRadialGradient(250,70,20,200,60,100);
            grad.addColorStop(0,"red");
            grad.addColorStop(0.5,"white");
            grad.addColorStop(1,"black");
            ctx.fillStyle=grad;
            ctx.fillRect(0,0,500,140);
        </script>
    </body>
</html>